﻿<%@ Page Title="Manage Users - Savory Housing" Language="C#" MasterPageFile="~/administrator/Admin.Master" AutoEventWireup="true"
    CodeBehind="ManageUsers.aspx.cs" Inherits="WebApplication.administrator.ManageUsers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPhead" runat="server">
    <script type="text/javascript" language="javascript"  >
        $(document).ready(function () {
            var sPageURL = window.location.search.substring(8);
            if (sPageURL == "true") {
                $("#a_Member").addClass("active");
            }
            else {
                $("#a_NotMember").addClass("active");
            }
        });
        function CheckedInput() {
            var checkedCheckBox;
            var dataGrid = document.all['CPAdmin_gvUserList'];
            var rows = dataGrid.rows;
            for (var index = 0; index < rows.length-1; index++) {
                var checkBox = document.getElementById('CPAdmin_gvUserList_chkSelect_'+index);
                if (checkBox.checked) {
                    confirm('Do You want to delete the selected Users.')
                    return true;
                }
            }
            alert('Please select at least one User to Delete.')
            return false
        }
         </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPAdmin" runat="server">

<!-- Admin Left Area Start -->
<div class="admin-left">
    <ul>
        <li><a href="ManageUsers.aspx?Member=true" id="a_Member">Membership List</a></li>
        <li><a href="ManageUsers.aspx?Member=false" id="a_NotMember">Without Membership List</a></li>
        <li><a href="#add" id="a_AddMember">Add User</a></li>
    </ul>
</div>
<!-- Admin Left Area End -->

    <div class="admin-right">
        <div class="page_title">
            Users List</div>
        <div class="displaying_user" id="divPage" runat="server" >
            Displaying Users
                <asp:LinkButton ID="lnkPrevious" runat="server" OnClick="lnkPrevious_Click" >
                <img src="../../images/gr-l_ar.jpg" alt="" border="0" align="top" />
                </asp:LinkButton>
            - <b><asp:Literal ID="ltrPageNumber" runat="server"></asp:Literal> </b>  Out of <b><asp:Literal ID="ltrTotalPage" runat="server"></asp:Literal></b> 
            <asp:LinkButton ID="lnkNext" runat="server" OnClick="lnkNext_Click" >
                <img src="../../images/gr-r_ar.jpg" alt="" border="0" align="top" />
                </asp:LinkButton>
                
        </div>
        <asp:LinkButton ID="btnDeleteSelected" runat="server"  CssClass="red_btn" Text="Delete" OnClick="btn_DeleteSelected" OnClientClick="CheckedInput();" ></asp:LinkButton>
        <div class="clear"></div>
        <div class="sorting_bar_ul">
            <asp:GridView ID="gvUserList" Width="100%" BorderWidth="0" CellPadding="0" CellSpacing="0" runat="server"
                AllowPaging="false" AllowSorting="false" DataKeyNames="UserID" AutoGenerateColumns="false">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelect" runat="server" CssClass="chck" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Name" HeaderStyle-CssClass="name" ItemStyle-CssClass="name"
                        ReadOnly="true" DataField="Name" />
                    <asp:BoundField HeaderText="Ac. Type" HeaderStyle-CssClass="actype" ItemStyle-CssClass="actype"
                        ReadOnly="true" DataField="AccountType" />
                    <asp:BoundField HeaderText="Country" HeaderStyle-CssClass="country" ItemStyle-CssClass="country"
                        ReadOnly="true" DataField="Country" />
                    <asp:BoundField HeaderText="Ac. Number" HeaderStyle-CssClass="acno" ItemStyle-CssClass="acno"
                        ReadOnly="true" DataField="AccountNo" />
                    <asp:TemplateField HeaderText="Edit" HeaderStyle-CssClass="edit" ItemStyle-CssClass="edit">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkEdit" runat="server" CssClass="edit" NavigateUrl='<%# "~/administrator/EditUser.aspx?T=E&ID=" + Eval("UserID")+"&IsMemebr="+ Eval("AccountType")%>'
                                ImageUrl="~/images/edit_icon.gif" ToolTip="Edit User"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField  HeaderText="Delete" HeaderStyle-CssClass="delete" ItemStyle-CssClass="delete">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkDelete" runat="server" CssClass="delete" CommandArgument='<%# Eval("UserID") %>' OnClick="btnDeleteUser" OnClientClick="javascript:confirm('Do you want to delete this User.')">
                            <img src="../../images/delete_icon.gif" alt="" border="0" align="top" />
                                </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div><br />
        <asp:LinkButton ID="btnDeleteSect" runat="server" OnClientClick="CheckedInput();" CssClass="red_btn" Text="Delete" OnClick="btn_DeleteSelected" ></asp:LinkButton>
        <%--        <a href="#" class="red_btn">Delete</a>--%>
    </div>
</asp:Content>
